{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import altair as alt\n",
    "\n",
    "from model import cnn_model\n",
    "from preprocess import mitbih_dataset\n",
    "from path_explain.path_explainer_tf import PathExplainerTF\n",
    "from path_explain.utils import set_up_environment, softplus_activation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "set_up_environment(visible_devices='0')\n",
    "\n",
    "x_train, y_train, x_test, y_test = mitbih_dataset()\n",
    "original_model = tf.keras.models.load_model('model.h5')\n",
    "\n",
    "interpret_model = cnn_model(for_interpretation=True)\n",
    "interpret_model.load_weights('model.h5', by_name=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "batch_input = tf.convert_to_tensor(x_test[:50])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "beta_dict = {}\n",
    "x_vals = []\n",
    "y_vals = []\n",
    "beta_vals = []\n",
    "\n",
    "for beta in [0.5, 1.0, 10.0, 100.0]:\n",
    "    softplus = softplus_activation(beta=beta)\n",
    "    x = tf.convert_to_tensor(np.linspace(-4.0, 4.0, num=100))\n",
    "    y = softplus(x)\n",
    "\n",
    "    x = x.numpy()\n",
    "    y = y.numpy()\n",
    "    betas = [beta] * 100\n",
    "\n",
    "    x_vals.append(x)\n",
    "    y_vals.append(y)\n",
    "    beta_vals.append(betas)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.DataFrame({\n",
    "    'x': np.concatenate(x_vals, axis=0),\n",
    "    'y': np.concatenate(y_vals, axis=0),\n",
    "    'beta': np.concatenate(beta_vals, axis=0)\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<div id=\"altair-viz-f8ead63b5bdc4176a265c0ed8c41404d\"></div>\n",
       "<script type=\"text/javascript\">\n",
       "  (function(spec, embedOpt){\n",
       "    const outputDiv = document.getElementById(\"altair-viz-f8ead63b5bdc4176a265c0ed8c41404d\");\n",
       "    const paths = {\n",
       "      \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n",
       "      \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n",
       "      \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.0.2?noext\",\n",
       "      \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n",
       "    };\n",
       "\n",
       "    function loadScript(lib) {\n",
       "      return new Promise(function(resolve, reject) {\n",
       "        var s = document.createElement('script');\n",
       "        s.src = paths[lib];\n",
       "        s.async = true;\n",
       "        s.onload = () => resolve(paths[lib]);\n",
       "        s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      });\n",
       "    }\n",
       "\n",
       "    function showError(err) {\n",
       "      outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n",
       "      throw err;\n",
       "    }\n",
       "\n",
       "    function displayChart(vegaEmbed) {\n",
       "      vegaEmbed(outputDiv, spec, embedOpt)\n",
       "        .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n",
       "    }\n",
       "\n",
       "    if(typeof define === \"function\" && define.amd) {\n",
       "      requirejs.config({paths});\n",
       "      require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n",
       "    } else if (typeof vegaEmbed === \"function\") {\n",
       "      displayChart(vegaEmbed);\n",
       "    } else {\n",
       "      loadScript(\"vega\")\n",
       "        .then(() => loadScript(\"vega-lite\"))\n",
       "        .then(() => loadScript(\"vega-embed\"))\n",
       "        .catch(showError)\n",
       "        .then(() => displayChart(vegaEmbed));\n",
       "    }\n",
       "  })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"data\": {\"name\": \"data-5d3de64e358a2df0ccf49fd738c2e7fa\"}, \"mark\": \"line\", \"encoding\": {\"color\": {\"type\": \"nominal\", \"field\": \"beta\"}, \"x\": {\"type\": \"quantitative\", \"field\": \"x\"}, \"y\": {\"type\": \"quantitative\", \"field\": \"y\"}}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v4.0.2.json\", \"datasets\": {\"data-5d3de64e358a2df0ccf49fd738c2e7fa\": [{\"x\": -4.0, \"y\": 0.2538560220859452, \"beta\": 0.5}, {\"x\": -3.919191919191919, \"y\": 0.26366174872354636, \"beta\": 0.5}, {\"x\": -3.8383838383838382, \"y\": 0.2738209446917205, \"beta\": 0.5}, {\"x\": -3.757575757575758, \"y\": 0.2843444629372778, \"beta\": 0.5}, {\"x\": -3.676767676767677, \"y\": 0.29524335283704795, \"beta\": 0.5}, {\"x\": -3.595959595959596, \"y\": 0.3065288537113453, \"beta\": 0.5}, {\"x\": -3.515151515151515, \"y\": 0.31821238747467107, \"beta\": 0.5}, {\"x\": -3.4343434343434343, \"y\": 0.33030555039082843, \"beta\": 0.5}, {\"x\": -3.3535353535353534, \"y\": 0.3428201039017601, \"beta\": 0.5}, {\"x\": -3.2727272727272725, \"y\": 0.35576796450198883, \"beta\": 0.5}, {\"x\": -3.191919191919192, \"y\": 0.3691611926335388, \"beta\": 0.5}, {\"x\": -3.111111111111111, \"y\": 0.3830119805796851, \"beta\": 0.5}, {\"x\": -3.0303030303030303, \"y\": 0.3973326393398097, \"beta\": 0.5}, {\"x\": -2.9494949494949494, \"y\": 0.41213558447206633, \"beta\": 0.5}, {\"x\": -2.8686868686868685, \"y\": 0.4274333208954608, \"beta\": 0.5}, {\"x\": -2.787878787878788, \"y\": 0.4432384266483486, \"beta\": 0.5}, {\"x\": -2.7070707070707067, \"y\": 0.4595635356062158, \"beta\": 0.5}, {\"x\": -2.6262626262626263, \"y\": 0.47642131916795644, \"beta\": 0.5}, {\"x\": -2.5454545454545454, \"y\": 0.4938244669266313, \"beta\": 0.5}, {\"x\": -2.4646464646464645, \"y\": 0.5117856663478894, \"beta\": 0.5}, {\"x\": -2.3838383838383836, \"y\": 0.5303175814868116, \"beta\": 0.5}, {\"x\": -2.3030303030303028, \"y\": 0.5494328307818278, \"beta\": 0.5}, {\"x\": -2.2222222222222223, \"y\": 0.5691439639725435, \"beta\": 0.5}, {\"x\": -2.141414141414141, \"y\": 0.5894634381967047, \"beta\": 0.5}, {\"x\": -2.0606060606060606, \"y\": 0.6104035933300539, \"beta\": 0.5}, {\"x\": -1.9797979797979797, \"y\": 0.6319766266414211, \"beta\": 0.5}, {\"x\": -1.8989898989898988, \"y\": 0.6541945668439505, \"beta\": 0.5}, {\"x\": -1.818181818181818, \"y\": 0.6770692476318004, \"beta\": 0.5}, {\"x\": -1.737373737373737, \"y\": 0.7006122807998466, \"beta\": 0.5}, {\"x\": -1.6565656565656566, \"y\": 0.7248350290518002, \"beta\": 0.5}, {\"x\": -1.5757575757575757, \"y\": 0.7497485786095605, \"beta\": 0.5}, {\"x\": -1.4949494949494948, \"y\": 0.7753637117434893, \"beta\": 0.5}, {\"x\": -1.414141414141414, \"y\": 0.8016908793494874, \"beta\": 0.5}, {\"x\": -1.333333333333333, \"y\": 0.8287401737041444, \"beta\": 0.5}, {\"x\": -1.2525252525252522, \"y\": 0.8565213015337676, \"beta\": 0.5}, {\"x\": -1.1717171717171713, \"y\": 0.8850435575365955, \"beta\": 0.5}, {\"x\": -1.0909090909090908, \"y\": 0.9143157984999436, \"beta\": 0.5}, {\"x\": -1.01010101010101, \"y\": 0.9443464181553001, \"beta\": 0.5}, {\"x\": -0.9292929292929291, \"y\": 0.9751433229143969, \"beta\": 0.5}, {\"x\": -0.8484848484848482, \"y\": 1.0067139086280144, \"beta\": 0.5}, {\"x\": -0.7676767676767673, \"y\": 1.0390650385066706, \"beta\": 0.5}, {\"x\": -0.6868686868686864, \"y\": 1.0722030223383574, \"beta\": 0.5}, {\"x\": -0.606060606060606, \"y\": 1.1061335971331634, \"beta\": 0.5}, {\"x\": -0.5252525252525251, \"y\": 1.1408619093179444, \"beta\": 0.5}, {\"x\": -0.4444444444444442, \"y\": 1.1763924985961858, \"beta\": 0.5}, {\"x\": -0.3636363636363633, \"y\": 1.212729283578994, \"beta\": 0.5}, {\"x\": -0.28282828282828243, \"y\": 1.249875549282707, \"beta\": 0.5}, {\"x\": -0.20202020202020154, \"y\": 1.2878339365771423, \"beta\": 0.5}, {\"x\": -0.1212121212121211, \"y\": 1.3266064336560328, \"beta\": 0.5}, {\"x\": -0.04040404040404022, \"y\": 1.3661943695879444, \"beta\": 0.5}, {\"x\": 0.040404040404040664, \"y\": 1.406598409991985, \"beta\": 0.5}, {\"x\": 0.12121212121212199, \"y\": 1.4478185548681544, \"beta\": 0.5}, {\"x\": 0.20202020202020243, \"y\": 1.4898541385973443, \"beta\": 0.5}, {\"x\": 0.2828282828282829, \"y\": 1.5327038321109898, \"beta\": 0.5}, {\"x\": 0.3636363636363642, \"y\": 1.5763656472153578, \"beta\": 0.5}, {\"x\": 0.44444444444444464, \"y\": 1.62083694304063, \"beta\": 0.5}, {\"x\": 0.525252525252526, \"y\": 1.6661144345704701, \"beta\": 0.5}, {\"x\": 0.6060606060606064, \"y\": 1.7121942031937698, \"beta\": 0.5}, {\"x\": 0.6868686868686869, \"y\": 1.7590717092070436, \"beta\": 0.5}, {\"x\": 0.7676767676767682, \"y\": 1.8067418061834386, \"beta\": 0.5}, {\"x\": 0.8484848484848486, \"y\": 1.8551987571128628, \"beta\": 0.5}, {\"x\": 0.92929292929293, \"y\": 1.9044362522073262, \"beta\": 0.5}, {\"x\": 1.0101010101010104, \"y\": 1.9544474282563105, \"beta\": 0.5}, {\"x\": 1.0909090909090917, \"y\": 2.0052248894090345, \"beta\": 0.5}, {\"x\": 1.1717171717171722, \"y\": 2.0567607292537677, \"beta\": 0.5}, {\"x\": 1.2525252525252526, \"y\": 2.10904655405902, \"beta\": 0.5}, {\"x\": 1.333333333333334, \"y\": 2.1620735070374777, \"beta\": 0.5}, {\"x\": 1.4141414141414144, \"y\": 2.2158322934909016, \"beta\": 0.5}, {\"x\": 1.4949494949494957, \"y\": 2.270313206692985, \"beta\": 0.5}, {\"x\": 1.5757575757575761, \"y\": 2.3255061543671367, \"beta\": 0.5}, {\"x\": 1.6565656565656575, \"y\": 2.381400685617457, \"beta\": 0.5}, {\"x\": 1.737373737373738, \"y\": 2.437986018173584, \"beta\": 0.5}, {\"x\": 1.8181818181818183, \"y\": 2.495251065813618, \"beta\": 0.5}, {\"x\": 1.8989898989898997, \"y\": 2.5531844658338496, \"beta\": 0.5}, {\"x\": 1.9797979797979801, \"y\": 2.611774606439401, \"beta\": 0.5}, {\"x\": 2.0606060606060614, \"y\": 2.671009653936115, \"beta\": 0.5}, {\"x\": 2.141414141414142, \"y\": 2.730877579610846, \"beta\": 0.5}, {\"x\": 2.2222222222222223, \"y\": 2.791366186194766, \"beta\": 0.5}, {\"x\": 2.3030303030303036, \"y\": 2.8524631338121313, \"beta\": 0.5}, {\"x\": 2.383838383838384, \"y\": 2.914155965325196, \"beta\": 0.5}, {\"x\": 2.4646464646464654, \"y\": 2.9764321309943544, \"beta\": 0.5}, {\"x\": 2.545454545454546, \"y\": 3.039279012381177, \"beta\": 0.5}, {\"x\": 2.626262626262627, \"y\": 3.1026839454305835, \"beta\": 0.5}, {\"x\": 2.7070707070707076, \"y\": 3.166634242676923, \"beta\": 0.5}, {\"x\": 2.787878787878788, \"y\": 3.2311172145271367, \"beta\": 0.5}, {\"x\": 2.8686868686868694, \"y\": 3.29612018958233, \"beta\": 0.5}, {\"x\": 2.94949494949495, \"y\": 3.361630533967016, \"beta\": 0.5}, {\"x\": 3.030303030303031, \"y\": 3.4276356696428407, \"beta\": 0.5}, {\"x\": 3.1111111111111116, \"y\": 3.494123091690797, \"beta\": 0.5}, {\"x\": 3.191919191919193, \"y\": 3.561080384552732, \"beta\": 0.5}, {\"x\": 3.2727272727272734, \"y\": 3.628495237229262, \"beta\": 0.5}, {\"x\": 3.353535353535354, \"y\": 3.696355457437114, \"beta\": 0.5}, {\"x\": 3.434343434343435, \"y\": 3.7646489847342632, \"beta\": 0.5}, {\"x\": 3.5151515151515156, \"y\": 3.8333639026261865, \"beta\": 0.5}, {\"x\": 3.595959595959597, \"y\": 3.9024884496709418, \"beta\": 0.5}, {\"x\": 3.6767676767676774, \"y\": 3.972011029604725, \"beta\": 0.5}, {\"x\": 3.757575757575758, \"y\": 4.041920220513036, \"beta\": 0.5}, {\"x\": 3.838383838383839, \"y\": 4.112204783075559, \"beta\": 0.5}, {\"x\": 3.9191919191919196, \"y\": 4.182853667915466, \"beta\": 0.5}, {\"x\": 4.0, \"y\": 4.253856022085945, \"beta\": 0.5}, {\"x\": -4.0, \"y\": 0.01814992791780978, \"beta\": 1.0}, {\"x\": -3.919191919191919, \"y\": 0.019662553203961614, \"beta\": 1.0}, {\"x\": -3.8383838383838382, \"y\": 0.021299904409421543, \"beta\": 1.0}, {\"x\": -3.757575757575758, \"y\": 0.023072036048322885, \"beta\": 1.0}, {\"x\": -3.676767676767677, \"y\": 0.02498977384684745, \"beta\": 1.0}, {\"x\": -3.595959595959596, \"y\": 0.027064767200287908, \"beta\": 1.0}, {\"x\": -3.515151515151515, \"y\": 0.02930954404596751, \"beta\": 1.0}, {\"x\": -3.4343434343434343, \"y\": 0.03173756805214023, \"beta\": 1.0}, {\"x\": -3.3535353535353534, \"y\": 0.0343632979732685, \"beta\": 1.0}, {\"x\": -3.2727272727272725, \"y\": 0.03720224896373467, \"beta\": 1.0}, {\"x\": -3.191919191919192, \"y\": 0.0402710555742603, \"beta\": 1.0}, {\"x\": -3.111111111111111, \"y\": 0.04358753607722984, \"beta\": 1.0}, {\"x\": -3.0303030303030303, \"y\": 0.04717075767800567, \"beta\": 1.0}, {\"x\": -2.9494949494949494, \"y\": 0.05104110206853326, \"beta\": 1.0}, {\"x\": -2.8686868686868685, \"y\": 0.055220330666634045, \"beta\": 1.0}, {\"x\": -2.787878787878788, \"y\": 0.05973164875920372, \"beta\": 1.0}, {\"x\": -2.7070707070707067, \"y\": 0.0645997676302442, \"beta\": 1.0}, {\"x\": -2.6262626262626263, \"y\": 0.06985096360595976, \"beta\": 1.0}, {\"x\": -2.5454545454545454, \"y\": 0.07551313279027838, \"beta\": 1.0}, {\"x\": -2.4646464646464645, \"y\": 0.08161584009713761, \"beta\": 1.0}, {\"x\": -2.3838383838383836, \"y\": 0.08819036101360016, \"beta\": 1.0}, {\"x\": -2.3030303030303028, \"y\": 0.09526971435424825, \"beta\": 1.0}, {\"x\": -2.2222222222222223, \"y\": 0.102888684097475, \"beta\": 1.0}, {\"x\": -2.141414141414141, \"y\": 0.11108382823466029, \"beta\": 1.0}, {\"x\": -2.0606060606060606, \"y\": 0.11989347242159475, \"beta\": 1.0}, {\"x\": -1.9797979797979797, \"y\": 0.12935768610716356, \"beta\": 1.0}, {\"x\": -1.8989898989898988, \"y\": 0.13951823873785946, \"beta\": 1.0}, {\"x\": -1.818181818181818, \"y\": 0.15041853361005328, \"beta\": 1.0}, {\"x\": -1.737373737373737, \"y\": 0.16210351697797648, \"beta\": 1.0}, {\"x\": -1.6565656565656566, \"y\": 0.17461956013746066, \"beta\": 1.0}, {\"x\": -1.5757575757575757, \"y\": 0.18801431240694727, \"beta\": 1.0}, {\"x\": -1.4949494949494948, \"y\": 0.2023365232305718, \"beta\": 1.0}, {\"x\": -1.414141414141414, \"y\": 0.21763583204378711, \"beta\": 1.0}, {\"x\": -1.333333333333333, \"y\": 0.23396252507754822, \"beta\": 1.0}, {\"x\": -1.2525252525252522, \"y\": 0.25136725893574163, \"beta\": 1.0}, {\"x\": -1.1717171717171713, \"y\": 0.2699007515598512, \"beta\": 1.0}, {\"x\": -1.0909090909090908, \"y\": 0.28961344208551293, \"beta\": 1.0}, {\"x\": -1.01010101010101, \"y\": 0.3105551220802779, \"beta\": 1.0}, {\"x\": -0.9292929292929291, \"y\": 0.3327745417046827, \"beta\": 1.0}, {\"x\": -0.8484848484848482, \"y\": 0.356318995424799, \"beta\": 1.0}, {\"x\": -0.7676767676767673, \"y\": 0.3812338929807246, \"beta\": 1.0}, {\"x\": -0.6868686868686864, \"y\": 0.40756232233183065, \"beta\": 1.0}, {\"x\": -0.606060606060606, \"y\": 0.4353446122010834, \"beta\": 1.0}, {\"x\": -0.5252525252525251, \"y\": 0.464617902570568, \"beta\": 1.0}, {\"x\": -0.4444444444444442, \"y\": 0.4954157319836391, \"beta\": 1.0}, {\"x\": -0.3636363636363633, \"y\": 0.5277676507371287, \"beta\": 1.0}, {\"x\": -0.28282828282828243, \"y\": 0.5616988689614905, \"beta\": 1.0}, {\"x\": -0.20202020202020154, \"y\": 0.5972299481638771, \"beta\": 1.0}, {\"x\": -0.1212121212121211, \"y\": 0.6343765440430116, \"beta\": 1.0}, {\"x\": -0.04040404040404022, \"y\": 0.6731492072892856, \"beta\": 1.0}, {\"x\": 0.040404040404040664, \"y\": 0.7135532476933261, \"beta\": 1.0}, {\"x\": 0.12121212121212199, \"y\": 0.7555886652551331, \"beta\": 1.0}, {\"x\": 0.20202020202020243, \"y\": 0.7992501501840792, \"beta\": 1.0}, {\"x\": 0.2828282828282829, \"y\": 0.844527151789773, \"beta\": 1.0}, {\"x\": 0.3636363636363642, \"y\": 0.8914040143734925, \"beta\": 1.0}, {\"x\": 0.44444444444444464, \"y\": 0.9398601764280836, \"beta\": 1.0}, {\"x\": 0.525252525252526, \"y\": 0.9898704278230936, \"beta\": 1.0}, {\"x\": 0.6060606060606064, \"y\": 1.0414052182616895, \"beta\": 1.0}, {\"x\": 0.6868686868686869, \"y\": 1.0944310092005172, \"beta\": 1.0}, {\"x\": 0.7676767676767682, \"y\": 1.1489106606574924, \"beta\": 1.0}, {\"x\": 0.8484848484848486, \"y\": 1.2048038439096476, \"beta\": 1.0}, {\"x\": 0.92929292929293, \"y\": 1.2620674709976123, \"beta\": 1.0}, {\"x\": 1.0101010101010104, \"y\": 1.3206561321812882, \"beta\": 1.0}, {\"x\": 1.0909090909090917, \"y\": 1.3805225329946043, \"beta\": 1.0}, {\"x\": 1.1717171717171722, \"y\": 1.4416179232770232, \"beta\": 1.0}, {\"x\": 1.2525252525252526, \"y\": 1.503892511460994, \"beta\": 1.0}, {\"x\": 1.333333333333334, \"y\": 1.567295858410882, \"beta\": 1.0}, {\"x\": 1.4141414141414144, \"y\": 1.6317772461852014, \"beta\": 1.0}, {\"x\": 1.4949494949494957, \"y\": 1.6972860181800673, \"beta\": 1.0}, {\"x\": 1.5757575757575761, \"y\": 1.7637718881645235, \"beta\": 1.0}, {\"x\": 1.6565656565656575, \"y\": 1.8311852167031182, \"beta\": 1.0}, {\"x\": 1.737373737373738, \"y\": 1.8994772543517144, \"beta\": 1.0}, {\"x\": 1.8181818181818183, \"y\": 1.9686003517918715, \"beta\": 1.0}, {\"x\": 1.8989898989898997, \"y\": 2.0385081377277587, \"beta\": 1.0}, {\"x\": 1.9797979797979801, \"y\": 2.1091556659051434, \"beta\": 1.0}, {\"x\": 2.0606060606060614, \"y\": 2.180499533027656, \"beta\": 1.0}, {\"x\": 2.141414141414142, \"y\": 2.252497969648802, \"beta\": 1.0}, {\"x\": 2.2222222222222223, \"y\": 2.3251109063196975, \"beta\": 1.0}, {\"x\": 2.3030303030303036, \"y\": 2.398300017384552, \"beta\": 1.0}, {\"x\": 2.383838383838384, \"y\": 2.4720287448519844, \"beta\": 1.0}, {\"x\": 2.4646464646464654, \"y\": 2.546262304743603, \"beta\": 1.0}, {\"x\": 2.545454545454546, \"y\": 2.620967678244824, \"beta\": 1.0}, {\"x\": 2.626262626262627, \"y\": 2.696113589868587, \"beta\": 1.0}, {\"x\": 2.7070707070707076, \"y\": 2.7716704747009517, \"beta\": 1.0}, {\"x\": 2.787878787878788, \"y\": 2.847610436637992, \"beta\": 1.0}, {\"x\": 2.8686868686868694, \"y\": 2.9239071993535033, \"beta\": 1.0}, {\"x\": 2.94949494949495, \"y\": 3.000536051563483, \"beta\": 1.0}, {\"x\": 3.030303030303031, \"y\": 3.0774737879810368, \"beta\": 1.0}, {\"x\": 3.1111111111111116, \"y\": 3.1546986471883414, \"beta\": 1.0}, {\"x\": 3.191919191919193, \"y\": 3.232190247493453, \"beta\": 1.0}, {\"x\": 3.2727272727272734, \"y\": 3.3099295216910076, \"beta\": 1.0}, {\"x\": 3.353535353535354, \"y\": 3.387898651508622, \"beta\": 1.0}, {\"x\": 3.434343434343435, \"y\": 3.4660810023955753, \"beta\": 1.0}, {\"x\": 3.5151515151515156, \"y\": 3.544461059197483, \"beta\": 1.0}, {\"x\": 3.595959595959597, \"y\": 3.623024363159885, \"beta\": 1.0}, {\"x\": 3.6767676767676774, \"y\": 3.701757450614525, \"beta\": 1.0}, {\"x\": 3.757575757575758, \"y\": 3.7806477936240808, \"beta\": 1.0}, {\"x\": 3.838383838383839, \"y\": 3.8596837427932607, \"beta\": 1.0}, {\"x\": 3.9191919191919196, \"y\": 3.938854472395881, \"beta\": 1.0}, {\"x\": 4.0, \"y\": 4.0181499279178094, \"beta\": 1.0}, {\"x\": -4.0, \"y\": 0.0, \"beta\": 10.0}, {\"x\": -3.919191919191919, \"y\": 0.0, \"beta\": 10.0}, {\"x\": -3.8383838383838382, \"y\": 0.0, \"beta\": 10.0}, {\"x\": -3.757575757575758, \"y\": 0.0, \"beta\": 10.0}, {\"x\": -3.676767676767677, \"y\": 0.0, \"beta\": 10.0}, {\"x\": -3.595959595959596, \"y\": 2.220446049250313e-17, \"beta\": 10.0}, {\"x\": -3.515151515151515, \"y\": 4.440892098500625e-17, \"beta\": 10.0}, {\"x\": -3.4343434343434343, \"y\": 1.110223024625156e-16, \"beta\": 10.0}, {\"x\": -3.3535353535353534, \"y\": 2.664535259100372e-16, \"beta\": 10.0}, {\"x\": -3.2727272727272725, \"y\": 6.217248937900858e-16, \"beta\": 10.0}, {\"x\": -3.191919191919192, \"y\": 1.3766765505351847e-15, \"beta\": 10.0}, {\"x\": -3.111111111111111, \"y\": 3.086420008457888e-15, \"beta\": 10.0}, {\"x\": -3.0303030303030303, \"y\": 6.905587213168236e-15, \"beta\": 10.0}, {\"x\": -2.9494949494949494, \"y\": 1.5498713423765986e-14, \"beta\": 10.0}, {\"x\": -2.8686868686868685, \"y\": 3.479438959174636e-14, \"beta\": 10.0}, {\"x\": -2.787878787878788, \"y\": 7.804867863111806e-14, \"beta\": 10.0}, {\"x\": -2.7070707070707067, \"y\": 1.7512657990421887e-13, \"beta\": 10.0}, {\"x\": -2.6262626262626263, \"y\": 3.9290792841407105e-13, \"beta\": 10.0}, {\"x\": -2.5454545454545454, \"y\": 8.81517081548489e-13, \"beta\": 10.0}, {\"x\": -2.4646464646464645, \"y\": 1.9777735005081886e-12, \"beta\": 10.0}, {\"x\": -2.3838383838383836, \"y\": 4.4373171802628844e-12, \"beta\": 10.0}, {\"x\": -2.3030303030303028, \"y\": 9.955569701462645e-12, \"beta\": 10.0}, {\"x\": -2.2222222222222223, \"y\": 2.233631057641306e-11, \"beta\": 10.0}, {\"x\": -2.141414141414141, \"y\": 5.011371316664374e-11, \"beta\": 10.0}, {\"x\": -2.0606060606060606, \"y\": 1.1243501678922202e-10, \"beta\": 10.0}, {\"x\": -1.9797979797979797, \"y\": 2.5225896895066414e-10, \"beta\": 10.0}, {\"x\": -1.8989898989898988, \"y\": 5.659677155349757e-10, \"beta\": 10.0}, {\"x\": -1.818181818181818, \"y\": 1.2698039872231908e-09, \"beta\": 10.0}, {\"x\": -1.737373737373737, \"y\": 2.8489296293698714e-09, \"beta\": 10.0}, {\"x\": -1.6565656565656566, \"y\": 6.3918525983218925e-09, \"beta\": 10.0}, {\"x\": -1.5757575757575757, \"y\": 1.4340746849809213e-08, \"beta\": 10.0}, {\"x\": -1.4949494949494948, \"y\": 3.217486743453531e-08, \"beta\": 10.0}, {\"x\": -1.414141414141414, \"y\": 7.218745242855074e-08, \"beta\": 10.0}, {\"x\": -1.333333333333333, \"y\": 1.6195954806895322e-07, \"beta\": 10.0}, {\"x\": -1.2525252525252522, \"y\": 3.633717452582173e-07, \"beta\": 10.0}, {\"x\": -1.1717171717171713, \"y\": 8.152582632672559e-07, \"beta\": 10.0}, {\"x\": -1.0909090909090908, \"y\": 1.8291025017639734e-06, \"beta\": 10.0}, {\"x\": -1.01010101010101, \"y\": 4.103723963584558e-06, \"beta\": 10.0}, {\"x\": -0.9292929292929291, \"y\": 9.206871775214286e-06, \"beta\": 10.0}, {\"x\": -0.8484848484848482, \"y\": 2.065533628294734e-05, \"beta\": 10.0}, {\"x\": -0.7676767676767673, \"y\": 4.633631976093954e-05, \"beta\": 10.0}, {\"x\": -0.6868686868686864, \"y\": 0.00010393013562861704, \"beta\": 10.0}, {\"x\": -0.606060606060606, \"y\": 0.00023302693399681083, \"beta\": 10.0}, {\"x\": -0.5252525252525251, \"y\": 0.0005220632559596462, \"beta\": 10.0}, {\"x\": -0.4444444444444442, \"y\": 0.0011675207207204586, \"beta\": 10.0}, {\"x\": -0.3636363636363633, \"y\": 0.0026006851833131135, \"beta\": 10.0}, {\"x\": -0.28282828282828243, \"y\": 0.005743297007747584, \"beta\": 10.0}, {\"x\": -0.20202020202020154, \"y\": 0.012454118667022727, \"beta\": 10.0}, {\"x\": -0.1212121212121211, \"y\": 0.026048974723237944, \"beta\": 10.0}, {\"x\": -0.04040404040404022, \"y\": 0.05113957489900139, \"beta\": 10.0}, {\"x\": 0.040404040404040664, \"y\": 0.09154361530304186, \"beta\": 10.0}, {\"x\": 0.12121212121212199, \"y\": 0.14726109593535974, \"beta\": 10.0}, {\"x\": 0.20202020202020243, \"y\": 0.21447432068722505, \"beta\": 10.0}, {\"x\": 0.2828282828282829, \"y\": 0.28857157983603043, \"beta\": 10.0}, {\"x\": 0.3636363636363642, \"y\": 0.3662370488196773, \"beta\": 10.0}, {\"x\": 0.44444444444444464, \"y\": 0.4456119651651651, \"beta\": 10.0}, {\"x\": 0.525252525252526, \"y\": 0.5257745885084856, \"beta\": 10.0}, {\"x\": 0.6060606060606064, \"y\": 0.6062936329946033, \"beta\": 10.0}, {\"x\": 0.6868686868686869, \"y\": 0.6869726170043154, \"beta\": 10.0}, {\"x\": 0.7676767676767682, \"y\": 0.7677231039965291, \"beta\": 10.0}, {\"x\": 0.8484848484848486, \"y\": 0.8485055038211315, \"beta\": 10.0}, {\"x\": 0.92929292929293, \"y\": 0.9293021361647051, \"beta\": 10.0}, {\"x\": 1.0101010101010104, \"y\": 1.010105113824974, \"beta\": 10.0}, {\"x\": 1.0909090909090917, \"y\": 1.0909109200115934, \"beta\": 10.0}, {\"x\": 1.1717171717171722, \"y\": 1.1717179869754355, \"beta\": 10.0}, {\"x\": 1.2525252525252526, \"y\": 1.252525615896998, \"beta\": 10.0}, {\"x\": 1.333333333333334, \"y\": 1.333333495292882, \"beta\": 10.0}, {\"x\": 1.4141414141414144, \"y\": 1.4141414863288668, \"beta\": 10.0}, {\"x\": 1.4949494949494957, \"y\": 1.4949495271243631, \"beta\": 10.0}, {\"x\": 1.5757575757575761, \"y\": 1.575757590098323, \"beta\": 10.0}, {\"x\": 1.6565656565656575, \"y\": 1.65656566295751, \"beta\": 10.0}, {\"x\": 1.737373737373738, \"y\": 1.7373737402226674, \"beta\": 10.0}, {\"x\": 1.8181818181818183, \"y\": 1.8181818194516224, \"beta\": 10.0}, {\"x\": 1.8989898989898997, \"y\": 1.8989898995558674, \"beta\": 10.0}, {\"x\": 1.9797979797979801, \"y\": 1.979797980050239, \"beta\": 10.0}, {\"x\": 2.0606060606060614, \"y\": 2.0606060607184964, \"beta\": 10.0}, {\"x\": 2.141414141414142, \"y\": 2.1414141414642556, \"beta\": 10.0}, {\"x\": 2.2222222222222223, \"y\": 2.2222222222445587, \"beta\": 10.0}, {\"x\": 2.3030303030303036, \"y\": 2.3030303030402592, \"beta\": 10.0}, {\"x\": 2.383838383838384, \"y\": 2.3838383838428214, \"beta\": 10.0}, {\"x\": 2.4646464646464654, \"y\": 2.4646464646484434, \"beta\": 10.0}, {\"x\": 2.545454545454546, \"y\": 2.5454545454554274, \"beta\": 10.0}, {\"x\": 2.626262626262627, \"y\": 2.62626262626302, \"beta\": 10.0}, {\"x\": 2.7070707070707076, \"y\": 2.7070707070708826, \"beta\": 10.0}, {\"x\": 2.787878787878788, \"y\": 2.7878787878788662, \"beta\": 10.0}, {\"x\": 2.8686868686868694, \"y\": 2.868686868686904, \"beta\": 10.0}, {\"x\": 2.94949494949495, \"y\": 2.9494949494949654, \"beta\": 10.0}, {\"x\": 3.030303030303031, \"y\": 3.0303030303030383, \"beta\": 10.0}, {\"x\": 3.1111111111111116, \"y\": 3.1111111111111147, \"beta\": 10.0}, {\"x\": 3.191919191919193, \"y\": 3.1919191919191943, \"beta\": 10.0}, {\"x\": 3.2727272727272734, \"y\": 3.272727272727274, \"beta\": 10.0}, {\"x\": 3.353535353535354, \"y\": 3.3535353535353543, \"beta\": 10.0}, {\"x\": 3.434343434343435, \"y\": 3.434343434343435, \"beta\": 10.0}, {\"x\": 3.5151515151515156, \"y\": 3.5151515151515156, \"beta\": 10.0}, {\"x\": 3.595959595959597, \"y\": 3.595959595959597, \"beta\": 10.0}, {\"x\": 3.6767676767676774, \"y\": 3.6767676767676774, \"beta\": 10.0}, {\"x\": 3.757575757575758, \"y\": 3.757575757575758, \"beta\": 10.0}, {\"x\": 3.838383838383839, \"y\": 3.838383838383839, \"beta\": 10.0}, {\"x\": 3.9191919191919196, \"y\": 3.9191919191919196, \"beta\": 10.0}, {\"x\": 4.0, \"y\": 4.0, \"beta\": 10.0}, {\"x\": -4.0, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.919191919191919, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.8383838383838382, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.757575757575758, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.676767676767677, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.595959595959596, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.515151515151515, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.4343434343434343, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.3535353535353534, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.2727272727272725, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.191919191919192, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.111111111111111, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -3.0303030303030303, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.9494949494949494, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.8686868686868685, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.787878787878788, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.7070707070707067, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.6262626262626263, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.5454545454545454, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.4646464646464645, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.3838383838383836, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.3030303030303028, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.2222222222222223, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.141414141414141, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -2.0606060606060606, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.9797979797979797, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.8989898989898988, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.818181818181818, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.737373737373737, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.6565656565656566, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.5757575757575757, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.4949494949494948, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.414141414141414, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.333333333333333, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.2525252525252522, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.1717171717171713, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.0909090909090908, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -1.01010101010101, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -0.9292929292929291, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -0.8484848484848482, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -0.7676767676767673, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -0.6868686868686864, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -0.606060606060606, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -0.5252525252525251, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -0.4444444444444442, \"y\": 0.0, \"beta\": 100.0}, {\"x\": -0.3636363636363633, \"y\": 2.2204460492503127e-18, \"beta\": 100.0}, {\"x\": -0.28282828282828243, \"y\": 5.211386877589127e-15, \"beta\": 100.0}, {\"x\": -0.20202020202020154, \"y\": 1.684124172032959e-11, \"beta\": 100.0}, {\"x\": -0.1212121212121211, \"y\": 5.442811326555193e-08, \"beta\": 100.0}, {\"x\": -0.04040404040404022, \"y\": 0.00017437443985325802, \"beta\": 100.0}, {\"x\": 0.040404040404040664, \"y\": 0.04057841484389391, \"beta\": 100.0}, {\"x\": 0.12121212121212199, \"y\": 0.12121217564023526, \"beta\": 100.0}, {\"x\": 0.20202020202020243, \"y\": 0.20202020203704368, \"beta\": 100.0}, {\"x\": 0.2828282828282829, \"y\": 0.2828282828282881, \"beta\": 100.0}, {\"x\": 0.3636363636363642, \"y\": 0.3636363636363642, \"beta\": 100.0}, {\"x\": 0.44444444444444464, \"y\": 0.44444444444444464, \"beta\": 100.0}, {\"x\": 0.525252525252526, \"y\": 0.525252525252526, \"beta\": 100.0}, {\"x\": 0.6060606060606064, \"y\": 0.6060606060606064, \"beta\": 100.0}, {\"x\": 0.6868686868686869, \"y\": 0.6868686868686869, \"beta\": 100.0}, {\"x\": 0.7676767676767682, \"y\": 0.7676767676767682, \"beta\": 100.0}, {\"x\": 0.8484848484848486, \"y\": 0.8484848484848486, \"beta\": 100.0}, {\"x\": 0.92929292929293, \"y\": 0.92929292929293, \"beta\": 100.0}, {\"x\": 1.0101010101010104, \"y\": 1.0101010101010104, \"beta\": 100.0}, {\"x\": 1.0909090909090917, \"y\": 1.0909090909090917, \"beta\": 100.0}, {\"x\": 1.1717171717171722, \"y\": 1.1717171717171722, \"beta\": 100.0}, {\"x\": 1.2525252525252526, \"y\": 1.2525252525252526, \"beta\": 100.0}, {\"x\": 1.333333333333334, \"y\": 1.333333333333334, \"beta\": 100.0}, {\"x\": 1.4141414141414144, \"y\": 1.4141414141414144, \"beta\": 100.0}, {\"x\": 1.4949494949494957, \"y\": 1.4949494949494957, \"beta\": 100.0}, {\"x\": 1.5757575757575761, \"y\": 1.5757575757575761, \"beta\": 100.0}, {\"x\": 1.6565656565656575, \"y\": 1.6565656565656575, \"beta\": 100.0}, {\"x\": 1.737373737373738, \"y\": 1.737373737373738, \"beta\": 100.0}, {\"x\": 1.8181818181818183, \"y\": 1.8181818181818183, \"beta\": 100.0}, {\"x\": 1.8989898989898997, \"y\": 1.8989898989898997, \"beta\": 100.0}, {\"x\": 1.9797979797979801, \"y\": 1.9797979797979801, \"beta\": 100.0}, {\"x\": 2.0606060606060614, \"y\": 2.0606060606060614, \"beta\": 100.0}, {\"x\": 2.141414141414142, \"y\": 2.141414141414142, \"beta\": 100.0}, {\"x\": 2.2222222222222223, \"y\": 2.2222222222222223, \"beta\": 100.0}, {\"x\": 2.3030303030303036, \"y\": 2.3030303030303036, \"beta\": 100.0}, {\"x\": 2.383838383838384, \"y\": 2.383838383838384, \"beta\": 100.0}, {\"x\": 2.4646464646464654, \"y\": 2.4646464646464654, \"beta\": 100.0}, {\"x\": 2.545454545454546, \"y\": 2.545454545454546, \"beta\": 100.0}, {\"x\": 2.626262626262627, \"y\": 2.626262626262627, \"beta\": 100.0}, {\"x\": 2.7070707070707076, \"y\": 2.7070707070707076, \"beta\": 100.0}, {\"x\": 2.787878787878788, \"y\": 2.787878787878788, \"beta\": 100.0}, {\"x\": 2.8686868686868694, \"y\": 2.8686868686868694, \"beta\": 100.0}, {\"x\": 2.94949494949495, \"y\": 2.94949494949495, \"beta\": 100.0}, {\"x\": 3.030303030303031, \"y\": 3.030303030303031, \"beta\": 100.0}, {\"x\": 3.1111111111111116, \"y\": 3.1111111111111116, \"beta\": 100.0}, {\"x\": 3.191919191919193, \"y\": 3.191919191919193, \"beta\": 100.0}, {\"x\": 3.2727272727272734, \"y\": 3.2727272727272734, \"beta\": 100.0}, {\"x\": 3.353535353535354, \"y\": 3.353535353535354, \"beta\": 100.0}, {\"x\": 3.434343434343435, \"y\": 3.434343434343435, \"beta\": 100.0}, {\"x\": 3.5151515151515156, \"y\": 3.5151515151515156, \"beta\": 100.0}, {\"x\": 3.595959595959597, \"y\": 3.595959595959597, \"beta\": 100.0}, {\"x\": 3.6767676767676774, \"y\": 3.6767676767676774, \"beta\": 100.0}, {\"x\": 3.757575757575758, \"y\": 3.757575757575758, \"beta\": 100.0}, {\"x\": 3.838383838383839, \"y\": 3.838383838383839, \"beta\": 100.0}, {\"x\": 3.9191919191919196, \"y\": 3.9191919191919196, \"beta\": 100.0}, {\"x\": 4.0, \"y\": 4.0, \"beta\": 100.0}]}}, {\"mode\": \"vega-lite\"});\n",
       "</script>"
      ],
      "text/plain": [
       "alt.Chart(...)"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "alt.Chart(data).mark_line().encode(\n",
    "    alt.X('x:Q'),\n",
    "    alt.Y('y:Q'),\n",
    "    alt.Color('beta:N')\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
